1. Field of the Invention
The present invention relates to the field of computer hardware design.
2. Related Art
Determining the solution of a first real value raised to a second real value, such as X.sup.Y, where X and Y respectively represent real (fixed point or floating point) numbers has proven to be a difficult problem for semiconductor ("chip") designers in the field of computer hardware. The function is non-linear, providing values that vary unevenly over a fixed, short range of X and Y.
One field where the calculation is important is computer graphics. In the OpenGL.TM. software interface for graphics hardware, the light associated with a graphics object is represented by four components: global light, ambient light, diffuse light, and specular light. Each of the four components is calculated by multiplying the amount of light associated with a material (for that component) by the amount of light associated with a light source (for that component). Diffuse light and specular light include scaling factors. The scaling factor for diffuse light is the dot product of a vector normal to the graphical object (normal vector) and a vector directed onto the graphical object from a light source (light vector). The scaling factor for specular light is the dot product of the normal vector and a vector representing the reflection of light from the graphical object (specular vector), raised to an exponent representing the amount of shininess of the graphical object. In this context the specular light dot product represents X, and the amount of shininess represents Y.
To provide a solution for X.sup.Y, the chip designer must balance cost with accuracy. RAM lookup tables and approximation techniques using ROMs have been used to calculate the function. For even reasonable approximations, the chip designer must choose between wasting much die area on the chip or wasting much processing power and/or time.
For example, a RAM lookup table can be used to calculate the function. The conventional RAM lookup table stores values for a fixed Y. In other words, for each fixed value of Y, the entire RAM lookup table is filled with data at location X corresponding to X.sup.Y. Unfortunately, each time the value of Y is changed, all of the entries in the RAM lookup table must be re-stored. For 10-bit addressing, with 1024 table entries, 1024 processor cycles are wasted when Y is changed. Accordingly some chip designers will reduce the number of bits for the address inputs and data outputs, which reduces the number of processor cycles, but which also reduces the precision of data outputs.
For higher end hardware systems, approximation techniques such as Newton-Raphson or Taylor Series expansion can be used. In these systems, ROM lookup tables for seeding and then large amounts of hardware are used which require large die area on the chip. For this reason, such systems are quite costly.
Accordingly, there is a need to quickly and accurately determine a hardware solution for X.sup.Y, which wastes minimum die area on the chip or processing power of the computer. A hardware solution that determines X.sup.Y is needed that does not loop. Such a loop stalls a pipeline which must stop and wait for the hardware solution for X.sup.Y to complete.